package main

import "fmt"

func sumArr(arr []int) {
	sum := 0
	for _, v := range arr {
		sum += v
		fmt.Println(v)
	}
	fmt.Println("sum -> ", sum)
}

func printString(str string) {
	for i, v := range str {
		fmt.Println("索引:", i, "unicode:", v)
	}
}

func printMap(kvs map[string]int) {
	for k, v := range kvs {
		fmt.Println("key:", k, "value:", v)
	}
}

func main() {
	var arr []int
	sumArr(arr)
	arr = append(arr, 1, 1, 2)
	sumArr(arr)
	printString("zhoushushu")

	kvs := map[string]int{"id": 1}
	printMap(kvs)
	value, exits := kvs["id"]
	fmt.Println(value, exits)

	delete(kvs, "id")
	value1, exits1 := kvs["id"]
	fmt.Println(value1, exits1)
	printMap(kvs)
}
